package com.tuiguangyuan.sdk.demo;

import com.tuiguangyuan.sdk.activity.BangquActivateAgent;
import com.tuiguangyuan.sdk.activity.LoginActivity;
import com.tuiguangyuan.sdk.activity.QrCodeActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class SimpleDemo extends Activity {

	private Button btnGetInfo;
	private Button btnLeft;
	private Button btnRight;
	private TextView tvMobileInfo;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_simple_demo);

		btnGetInfo = (Button) findViewById(R.id.btnGetInfo);
		tvMobileInfo = (TextView) findViewById(R.id.tvMobileInfo);
		btnGetInfo.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// 该方法功能获取设备信息并提交，可直接调用。切忌放在onCreate方法中，会因为加载时间过长发生ANR报错，最好用线程启动
				BangquActivateAgent bb = new com.tuiguangyuan.sdk.activity.BangquActivateAgent(
						SimpleDemo.this);
				bb.Activate();
				tvMobileInfo.setText(bb.GetMobileInfo());
			}
		});
		btnLeft = (Button) findViewById(R.id.btnLeft1);
		btnLeft.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// 该方法是有邮箱时跳转的推广界面
				Intent intent = new Intent(SimpleDemo.this, QrCodeActivity.class);
				intent.putExtra("Email", "zhang20084@126.com");
				startActivity(intent);
			}
		});
		btnRight = (Button) findViewById(R.id.btnRight1);
		btnRight.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(SimpleDemo.this, LoginActivity.class);
				startActivity(intent);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_simple_demo, menu);
		return true;
	}

}
